<div class="form">

<?php 
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/jquery.number_format.js", CClientScript::POS_END);
$form=$this->beginWidget('CActiveForm', array(
	'id'=>'material-form',
	'enableAjaxValidation'=>false,
)); ?>

	<?php echo $form->errorSummary($model); ?>
         <?php echo $this->renderFlash(); ?>

        <table border="0" cellpadding="0" cellspacing="0"  id="id-form">
            <tr>
                <th valign="top"><?php echo $form->labelEx($model,'materialname'); ?></th>
                <td><?php echo $form->textField($model,'materialname', array('class' => 'inp-form')); ?></td>
                <td></td>
            </tr>            
            <tr>
                <th valign="top"><?php echo $form->labelEx($model,'materiallimit'); ?></th>
                <td><?php echo $form->textField($model,'materiallimit',array('rows'=>6, 'cols'=>50, 'class' => 'inp-form',
                    'onkeyup' => '
                            var format_number = $().number_format($(this).val().replace(/\s/g, ""), {
                                numberOfDecimals:0,
                                decimalSeparator: ",",
                                thousandSeparator: " "
                            });

                            $(this).val(format_number);
                        ',
                    'value' => number_format($model->materiallimit, 0, "", " "),
                    'onfocus' => '$(this).select()'
                    )); ?></td>
                <td></td>
            </tr>
            <tr>
                <th valign="top"><?php echo $form->labelEx($model,'addquantity'); ?></th>
                <td><?php echo $form->textField($model,'addquantity',array('rows'=>6, 'cols'=>50, 'class' => 'inp-form',
                    'onkeyup' => '
                            var format_number = $().number_format($(this).val().replace(/\s/g, ""), {
                                numberOfDecimals:0,
                                decimalSeparator: ",",
                                thousandSeparator: " "
                            });

                            $(this).val(format_number);
                        ',
                    'value' => number_format($model->addquantity, 0, "", " "),
                    'onfocus' => '$(this).select()'
                    )); ?></td>
                <td></td>
            </tr>
            <tr>
                <th valign="top"><?php echo $form->labelEx($model,'addprice'); ?></th>
                <td><?php echo $form->textField($model,'addprice',array('rows'=>6, 'cols'=>50, 'class' => 'inp-form',
                    'onkeyup' => '
                            var format_number = $().number_format($(this).val().replace(/\s/g, ""), {
                                numberOfDecimals:0,
                                decimalSeparator: ",",
                                thousandSeparator: " "
                            });

                            $(this).val(format_number);
                        ',
                    'value' => number_format($model->addprice, 0, "", " "),
                    'onfocus' => '$(this).select()'
                    )); ?></td>
                <td></td>
            </tr>
            <tr>
                <th valign="top"><?php echo $form->labelEx($model,'unitid'); ?></th>
                <td><?php echo $form->dropDownList($model,'unitid',  CHtml::listData(Unit::model()->findAll(), 'unitid', 'unitname'), array('class' => 'styledselect_form_1')); ?></td>
                <td></td>
            </tr>
            <tr>
                <th valign="top"><?php echo $form->labelEx($model,'supplierid'); ?></th>
                <td><?php echo $form->dropDownList($model,'supplierid',  CHtml::listData(Supplier::model()->findAll(), 'supplier_id', 'supplier_name'), array('class' => 'styledselect_form_1')); ?></td>
                <td></td>
            </tr>
            <tr>
                <th>&nbsp;</th>
                <td valign="top">
                    <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class' => 'form-submit')); ?>
                </td>
                <td></td>
            </tr>
            
        </table>	
<?php $this->endWidget(); ?>

</div><!-- form -->